<?php

class DBMLogicalFilter implements DBMFilter {
	const EQUALS 				= 1;
	const NOT_EQUALS 		= 2;
	const BIGGER 				= 3;
	const BIGGER_OR_EQ	= 4;
	const SMALLER			= 5;
	const SMALLER_OR_EQ	= 6;

	private $property;
	private $logicalOperation;
	private $expectedValue;
	
	
	public function __construct($property, $logicalOperation, $expectedValue){
		$this->setProperty($property);
		$this->setLogicalOperation($logicalOperation);
		$this->setExpectedValue($expectedValue);
	}
	
	public function getProperty(){
		return $this->property;
	}
	public function setProperty($property){
		$this->property = $property; 
	}
	public function getLogicalOperation(){
		return $this->logicalOperation;
	}
	public function setLogicalOperation($logicalOperation){
		$this->logicalOperation = $logicalOperation;
	}
	public function getExpectedValue(){
		return $this->expectedValue;
	}
	public function setExpectedValue($expectedValue){
		$this->expectedValue = $expectedValue;
	}
	public function toSQL($databaseType, DBMCommand $command){
		if($databaseType == DBManager::TYPE_MSSQL){
			return DBMLogicalFilterTranslator::translateToSQLServer($this, $command);	
		} elseif($databaseType == DBManager::TYPE_MYSQL){
			return DBMLogicalFilterTranslator::translateToMySQL($this, $command);
		} elseif($databaseType == DBManager::TYPE_POSTGRESQL){
			return DBMLogicalFilterTranslator::translateToPostgreSQL($this, $command);
		} else {
			throw new UnsupportedDatabaseException($databaseType);
		}
	}
}

?>
